/*
ID: guoxu1
PROG: calfflac
LANG: C++
*/
//#include <iostream>
#include <fstream>
#include <vector>
using namespace std;

const int max_text_length = 20000;
const int max_pal_length = 2000;

int ord[256];

inline bool check( char* buf, int size, int l, int h,
 int* low, int* high )
{
  while( ord[buf[l]] == ord[buf[h]] && l >= 0 && h < size )
    {
      *low = l;
      *high = h;
      do { l--; } while( l >= 0 && ord[ buf[l] ] < 0);
      do { h++; } while( h < size && ord[ buf[h] ] < 0);
    }
  return true;
}

int main()
{
  for( int i = 0; i < 256; i++ ) ord[i] = -1;
  for( int i = 'A'; i <= 'Z'; i++ ) ord[i] = i - 'A';
  for( int i = 'a'; i <= 'z'; i++ ) ord[i] = i - 'a';
  
  ifstream fin( "calfflac.in" );
  ofstream fout( "calfflac.out" );

  char buf[ max_text_length ] = {0};
  fin.read( buf, max_text_length );
  int count = fin.gcount();

  int mlow = 1;
  int mhigh = 0;
  for( int i = 0; i < count; i++ )
  {
    if( ord[buf[i]] == -1 ) continue;
  
    int low = 0, high = 0;
    if( check( buf, count, i, i, &low, &high ) )
    {
      if( high - low + 1 > mhigh - mlow + 1 )
      {
        mlow = low;
        mhigh = high;
      }
    }

    int j = i;
    do { j++; } while( j < count && ord[ buf[j] ] < 0);
    if( j == count ) continue;
    if( check( buf, count, i, j, &low, &high ) )
    {
      if( high - low + 1 > mhigh - mlow + 1 )
      {
        mlow = low;
        mhigh = high;
      }      
    }
  }

  int length = 0;
  for( int i = mlow; i <= mhigh; i++ )
  {
    if( ord[ buf[i] ] != -1 ) length++;
  }
  fout << length << endl;
  for( int i = mlow; i <= mhigh; i++ )
  {
    fout << buf[i];
  }
  fout << endl;  
 
  return 0;
}

